package com.hmxx.myblogproject.controller;

import com.hmxx.myblogproject.entity.MyBlogUser;
import com.hmxx.myblogproject.service.MyBlogUserService;
import com.hmxx.myblogproject.util.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @description:
 * @Author: {27106}
 * @Date: {2021/11/15 19:51}
 */
@RestController
@RequestMapping("/user")
public class MyBlogUserController {
    @Resource
    private MyBlogUserService service;

    @PostMapping("/login")
    public Object login(@RequestBody MyBlogUser myBlogUser, HttpServletRequest request){
        return service.queryUser(myBlogUser);
    }

    @PostMapping("/register")
    public Object register(@RequestBody MyBlogUser myBlogUser){
        return service.register(myBlogUser);
    }

    @GetMapping("/loginStatus")
    public Object loginStatus(HttpServletRequest request){
        return service.loginStatus(request);
    }

    @GetMapping("/unlogin")
    public Object unlogin(HttpServletRequest request){
        return ResponseUtil.ok();
    }


}
